< previous page page_320 next page >

Page 320
LISTING 14.2.CONTINUED
9f8044bafea36a1f728739c0bb58ef4c.gif
33: End Sub
34:
35: Public Function getINI(argHeader As String, argName As String)
36:
37:     Dim sReturn As String
38:     Dim sProfileString As String
39:     Dim iProfile As Integer
40:     Dim iCount As Integer
41:
42:     sReturn = String(120,  )
43:     iProfile = GetPrivateProfileString(argHeader, argName,  ,
  sReturn, Len(sReturn), iniFileName)
44:     iCount = 1
45:     Do Until iCount = Len(sReturn)
46:         If Asc(Mid$( sReturn, iCount, 1)) > 31 Then sProfileString =
  final$ & Mid$(sReturn, Count, 1)
47:     iCount = iCount + 1
48:     Loop
49:
50:     GetINI = Trim(sProfileString)
51:
52: End Function
53:
54:
55: Public Sub getSettings()
56:     'The app should look at an ini file by the same name
57:     iniFileName = App.Path & \SomeFile.ini
58:     ' Get ini settings ---
59:     AppName = GetINI(YourApp, Name)
60:     AppRev = GetINI(YourApp , Version)
61:
62:     'Get connection information
63:     DSN = GetINI(ODBC, DSN)
64:     mDbName = GetINI(ODBC, dbname)
65:     mDbConnect = GetINI(ODBC, dbconnect)
66:     mODBCUser = GetINI(ODBC, username)
67:     mRetries = Val(GetINI(ODBC, retries))
68:
69:     'Get user preference settings
70:     mDRIVE = GetINI(Preferences, Favorite Macro)
71:     mFrmBackColor = GetINI(Screen, Favorite Form Color)
72:     'Get the Application font
73:     mFontName = GetINI(Screen, Favorite Font Name)
74: End Sub

The writeOutputFile method accepts an argument, argOutput, that represents the contents of a new INI file. The getINI method retrieves a particular item from an INI file

 
< previous page page_320 next page >

If you like this book, buy it!